<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			#parent {
				height: 200px;
				width: 200px;
				border: 1px solid red;

				position: relative;
				/* 设置相对定位 */
			}

			#child {
				height: 50px;
				width: 50px;
				color: white;
				background-color: blue;

				/* 绝对定位，4 个方向设置为 0 后，margin 设为 auto */
				position: absolute;
				left: 0;
				top: 0;
				right: 0;
				bottom: 0;
				margin: auto;
			}
		</style>
	</head>
	<body>
		<div id="parent">
			<div id="child"></div>
		</div>
	</body>
</html>
